<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  {{extend './template/footer.html'}}
  {{block 'others'}}
  <div>
    <h2>{{title}}</h2>
    <hr>

    <h3>遍历</h3>
    <ul>
      {{each list value i}}
      <li>索引：{{i+1}} | 姓名：{{value}}</li>
      {{/each}}
    </ul>

    <h3>标准语法</h3>
    <ul>
      <li>value: {{a}}</li>
      <li>data.key: {{obj.name}}</li>
      <li>data['key']: {{obj.bro}}</li>
      <li>三则运算： {{a>b ? 'a大于b': 'a不大于b'}}</li>
      <li>基本运算： a + b = {{a+b}}</li>
    </ul>

    <h3>原文输出</h3>
    <div>{{@ html}}</div>

    <h3>条件语句</h3>
    <div>
      {{if flag}}
      <div>1flag: {{flag}}</div>
      {{else}}
      <div>0flag: {{flag}}</div>
      {{/if}}
    </div>

    <h3>循环</h3>
    <ul>
      {{each obj val key}}
      <li>{{key}} : {{val}}</li>
      {{/each}}
    </ul>

    <h3>变量</h3>
    <div>设置变量{{set username = list[0]}}</div>
    <div>使用变量:{{username}}</div>

    <h3>子模板</h3>
    {{include './template/child-template.html'}}

    <h3>过滤器</h3>
    {{ date | getDate}}

    <h3>模板变量</h3>
    <% $imports.log('hello world') %>
  </div>
  {{/block}}
  


  <div>
    {{extend './template/footer.html'}}
    {{block 'footer'}} 
      <hr>
      <h2>模板继承：这是一个footer</h2>
    {{/block}}
  </div>
</body>
</html>